home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #9 / Amiga Plus CD - 2004 - No. 09.iso / amigaplus / highlights / sensiblesoccer / whdload / install < prev    next >
Text File  |  2004-08-03  |  5KB  |  196 lines

  1. ; $Id: Install 1.3 2004/07/21 06:45:56 wepl Exp wepl $
  2. ;----------------------------
  3. ; Check version and install if newer
  4. ; IN:    #source-file
  5. ;    #dest-file
  6.  
  7. (procedure P_install
  8.   (set #sver (getversion #source-file))
  9.   (if
  10.     (exists #dest-file)
  11.     (set #dver (getversion #dest-file))
  12.     (set #dver 0)
  13.   )
  14.   (if
  15.     (< #sver #dver)
  16.     (abort
  17.       "The installation has determinated that the already installed program "
  18.       "\"" #dest-file "\" has a newer version than the program to install. "
  19.       "The current WHDLoad package seems to be outdated. Therefore the "
  20.       "installation will be canceled. Please try to get a newer version of "
  21.       "the WHDLoad package."
  22.     )
  23.   )
  24.   (set #prompt
  25.     (
  26.       "\nNow installing the program\n\n\"%s\" with version %ld.%ld\n\n"
  27.       (fileonly #source-file) (/ #sver 65536) (BITAND #sver 65535)
  28.     )
  29.   )
  30.   (if
  31.     (> #dver 0)
  32.     (set #prompt 
  33.       (
  34.         "%sby overwriting\n\n\"%s\" with version %ld.%ld"
  35.         #prompt #dest-file (/ #dver 65536) (BITAND #dver 65535)
  36.       )
  37.     )
  38.     (set #prompt ("%sinto the directory\n\n\"%s\"" #prompt (pathonly #dest-file)))
  39.   )
  40.   (if
  41.     (= @user-level 2)
  42.     (set #choice
  43.       (askbool
  44.         (prompt #prompt)
  45.         (default 1)
  46.         (choices "Install" "Skip")
  47.         (help @askbool-help)
  48.       )
  49.     )
  50.     (set #choice 1)
  51.   )
  52.   (if
  53.     (= #choice 1)
  54.     (copyfiles
  55.       (help @copyfiles-help)
  56.       (source #source-file)
  57.       (dest (pathonly #dest-file))
  58.       (newname (fileonly #dest-file))
  59.     )
  60.   )
  61. )
  62.  
  63. ;----------------------------
  64.  
  65. (if
  66.   (exists "C/InstallBB")
  67.   (set #mode "dev")
  68.   (set #mode "usr")
  69. )
  70.  
  71. (if
  72.   (= #mode "dev")
  73.   (welcome
  74.     "Welcome to the WHDLoad installation.\n"
  75.     "This script will copy all files which need a special location to their recommend places.\n"
  76.     "All other files like the source examples and the Install Templates will not copied."
  77.     "Therefore it is recommend to move this drawer yourself to your prefered location.\n"
  78.     "If you don't want to install all provided programs, please select the expert mode where you can skip these."
  79.   )
  80.   (welcome
  81.     "Welcome to the WHDLoad installation."
  82.   )
  83. )
  84.  
  85. (set @default-dest
  86.   (askdir
  87.     (prompt "Where should WHDLoad and the other tools installed ?\nThe location must be reachable via the path !\nRecommend is \"C:\".")
  88.     (help @askdir-help)
  89.     (default "C:")
  90.     (disk)
  91.   )
  92. )
  93.  
  94. (set #path "C")
  95. (foreach #path "#?"
  96.   (
  97.     (set #source-file (tackon #path @each-name))
  98.     (set #dest-file   (tackon @default-dest @each-name))
  99.     (P_install)
  100.   )
  101. )
  102.  
  103. (if
  104.   (exists "S:whdload.prefs")
  105.   (
  106.     (set #ver (getversion "C/WHDLoad"))
  107.     (set #newname ("whdload.prefs.%ld.%ld" (/ #ver 65536) (BITAND #ver 65535)))
  108.     (copyfiles
  109.       (help @copyfiles-help)
  110.       (source "S/whdload.prefs")
  111.       (dest "S:")
  112.       (newname #newname)
  113.     )
  114.     (message
  115.        "\nThere was already a WHDLoad Preferences files installed. Therefore the new"
  116.        " one has been installed as \"S:" #newname "\". You should check if there are"
  117.        " new options which may be useful for you and adapt your existing Preferences"
  118.        " file."
  119.     )
  120.   )
  121.   (copyfiles
  122.     (help @copyfiles-help)
  123.     (source "S/whdload.prefs")
  124.     (dest "S:")
  125.   )
  126. )
  127.  
  128. (if
  129.   (= #mode "dev")
  130.   (
  131.     (set #dest
  132.       (askdir
  133.         (prompt "Where should the include files installed ?")
  134.         (help @askdir-help)
  135.         (default "Includes:")
  136.       )
  137.     )
  138.     (set #path "include")
  139.     (foreach #path "#?"
  140.       (copyfiles
  141.         (help @copyfiles-help)
  142.         (source (tackon #path @each-name))
  143.         (dest #dest)
  144.       )
  145.     )
  146.     (set #dest
  147.       (askdir
  148.         (prompt "Where should the autodoc file installed ?")
  149.         (help @askdir-help)
  150.         (default "Autodocs:")
  151.       )
  152.     )
  153.     (copyfiles
  154.       (help @copyfiles-help)
  155.       (source "autodoc/whdload.doc")
  156.       (dest #dest)
  157.     )
  158.     (exit
  159.       "\n"
  160.       "Installation is complete.\n"
  161.       "\n"
  162.       "All files which need a special location has been copied.\n"
  163.       "Please move all other files yourself to your prefered place.\n"
  164.       "\n"
  165.       "Hope WHDLoad and the tools will be useful for you.\n"
  166.       "\n"
  167.       "Bye Bert."
  168.       (quiet)
  169.     )
  170.   )
  171.   (
  172.     (set #dest
  173.       (askdir
  174.         (prompt "Where should the documentation for WHDLoad installed ?\nA drawer WHDLoad will be created there.")
  175.         (help @askdir-help)
  176.         (default "Help:")
  177.       )
  178.     )
  179.     (copyfiles
  180.       (help @copyfiles-help)
  181.       (source "Docs")
  182.       (dest (tackon #dest "WHDLoad"))
  183.       (all)
  184.       (infos)
  185.     )
  186.     (exit
  187.       "\n"
  188.       "Installation is now complete.\n"
  189.       "Please read the documentation carefully on how to use and configure WHDLoad for your needs."
  190.       (quiet)
  191.     )
  192.   )
  193. )
  194.  
  195.  
  196.